package com.aquarium.application;

import java.util.Collection;

import com.aquarium.metier.Interventions;
import com.aquarium.metier.InterventionsDAO;
import com.aquarium.metier.InterventionsDTO;

/**
 * 
 * @author Ciel
 *
 */
public class GererInterventionsCtrl implements CtrlSkeleton<InterventionsDTO> {
	protected InterventionsDAO unIntervDAO = new InterventionsDAO();
	protected Interventions unInterv = new Interventions();
	protected InterventionsDTO unIntervDTO = new InterventionsDTO();
	
	@Override
	public void createObj(InterventionsDTO Objet)
			throws NicheAPoissonsException, HelperException {
		unInterv = HelperInterventions.toInterventions(Objet);
		unIntervDAO.createObj(unInterv);
		
	}

	@Override
	public InterventionsDTO retreiveObj(int identifiant) throws NicheAPoissonsException, HelperException {
		unInterv = unIntervDAO.retreiveObj(identifiant);
		return HelperInterventions.toInterventionsDTO(unInterv);
	}

	@Override
	public void updateObj(InterventionsDTO Objet_a_modifier)
			throws NicheAPoissonsException, HelperException {
		unInterv = HelperInterventions.toInterventions(Objet_a_modifier);
		unIntervDAO.updateObj(unInterv);
		
	}

	@Override
	public void deleteObj(int Identifiant) throws NicheAPoissonsException {
		unIntervDAO.deleteObj(Identifiant);
		
	}

	@Override
	public Collection<InterventionsDTO> retreiveAllObj()
			throws NicheAPoissonsException, HelperException {
		Collection<InterventionsDTO> uneListInterv = HelperInterventions.toInterventionsDTO(unIntervDAO.retreiveAllObj());
		return uneListInterv;
	}
	
	public Collection<InterventionsDTO> retreiveAllObjByIdAqua(Integer aqua_id) throws NicheAPoissonsException, HelperException{
		Collection<InterventionsDTO> uneListInterv = HelperInterventions.toInterventionsDTO(unIntervDAO.retreiveAllObjByAqua(aqua_id));
		return uneListInterv;
	}

	@Override
	public void deleteAllobj() throws NicheAPoissonsException {
		unIntervDAO.deleteAllobj();
		
	}

}
